package com.lele.controller;

import com.lele.utils.JWTUtil;
import com.lele.utils.Result;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/send")
public class TestAddress {
    @Resource
    private JavaMailSender javaMailSender;
    @Resource
    private JWTUtil jwtUtil;


    @GetMapping("/tosend")
    public Result address(){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("乐乐你好帅哦");
        message.setText("变有钱");
        message.setTo("1577917056@qq.com");
        message.setFrom("1577917056@qq.com");
        javaMailSender.send(message);
        return Result.OK();
    }

    @GetMapping("/")
    public Result test(){
        return Result.OK(jwtUtil.getSECRET());
    }
}
